import { Inject, Injectable, InjectionToken } from '@angular/core';

const FLOWER_TOKEN = new InjectionToken<string>('flower');
@Injectable({
  providedIn: 'root'
})
export class FlowerService {
  private flower: string;
  constructor(@Inject(FLOWER_TOKEN) flower: string = '黄花') {
    this.flower = flower;
  }

  logFlower() {
    console.log('这是' + this.flower);
  }
}
